package br.com.mmm.javacenter.framework.reflection.injectors;

import br.com.mmm.javacenter.framework.annotations.InjectorComponent;
import br.com.mmm.javacenter.framework.reflection.ReflectionFacade;

@InjectorComponent({Integer.class,int.class})
public class IntegerInjector implements Injector{
	public void inject(ReflectionFacade rf,String field, Object value) {
		if(value!=null){
			try{
				Integer i = Integer.valueOf(value.toString());
				rf.set(field, i);
			}catch (NumberFormatException e) {
				rf.set(field, null);
			}
		}
	}

}
